package cn.java75.sp.ctrl;

import cn.java75.sp.entity.Admin;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author oldliu
 * @since 1.0
 */
@RestController
@RequestMapping("hello")

public class HelloController {
    @GetMapping("sayhi")
    @ApiOperation("问候")
    public String sayHello() {
        return "hello,springboot";
    }

    @Autowired
    @Qualifier("redisTemplate")
    private RedisTemplate redisTemplate;

    @GetMapping("testok")
    public String testOk() {
        redisTemplate.opsForValue().set("demo", new Admin(1L, "222", "#33"));

        return String.valueOf(redisTemplate.opsForValue().get("demo"));
    }
}
